<?php

/**
 * Feature Name:	Kader player
 */

if ( ! class_exists( 'Kader_Player' ) ) {

	class Kader_Player extends Kader {

		/**
		 * Instance holder
		 *
		 * @var		NULL | Kader_Player
		 */
		private static $instance = NULL;
		
		/**
		 * Method for ensuring that only one instance of this object is used
		 *
		 * @return	Kader_Player
		 */
		public static function get_instance() {
				
			if ( ! self::$instance )
				self::$instance = new self;
			return self::$instance;
		}
		
		/**
		 * Setting up some data, initialize translations and start the hooks
		 *
		 * @return	void
		 */
		public function __construct () {
			
			// Add Custom Post Type
			add_filter( 'init', array( $this, 'init_post_type' ) );
			
			// Add Custom Taxonomy
			add_filter( 'init', array( $this, 'init_custom_taxonomy' ) );
		}
		
		
		/**
		 * Initialize Post Type
		 *
		 * @return	void
		 */
		public function init_post_type() {
			
			$labels = array(
	
					'name'               => _x( 'Spieler', 'Post Type General Name', 'kader' ),
					'singular_name'       => _x( 'Spieler', 'Post Type Singular Name', 'kader' ),
					'menu_name'           => __( 'Spieler', 'kader' ),
					'parent_item_colon'   => __( 'Eltern Spieler', 'kader' ),
					'all_items'           => __( 'Alle Spieler', 'kader' ),
					'view_item'           => __( 'Spieler ansehen', 'kader' ),
					'add_new_item'        => __( 'Neuen Spieler hinzufuegen', 'kader' ),
					'add_new'             => __( 'Neuer Spieler', 'kader' ),
					'edit_item'           => __( 'Spieler Bearbeiten', 'kader' ),
					'update_item'         => __( 'Spieler aktualisieren', 'kader' ),
					'search_items'        => __( 'Spieler suchen', 'kader' ),
					'not_found'           => __( 'Keinen Spieler gefunden', 'kader' ),
					'not_found_in_trash'  => __( 'Keinen Spieler im Papierkorb gefunden', 'kader' ),
											
			);
		
			$supports = array(
					'title',
					'editor',
					'thumbnail',
					'custom-fields'
			);
		
			$post_type_args = array(
					'public' 				=> TRUE,
					'labels'				=> $labels,
					'rewrite'				=> array( 'slug' => _x('player', 'url slug', 'kader') ),
					'show_ui' 				=> TRUE,
					'supports' 				=> $supports,
					'query_var' 			=> TRUE,
					'has_archive'			=> TRUE,
					'taxonomies'          	=> array( 'Position' ),
					'hierarchical' 			=> FALSE,
					'menu_position' 		=> NULL,
					'capability_type' 		=> 'post',
					'publicly_queryable'	=> TRUE,
			);
		
			register_post_type( 'Player', $post_type_args );
		}
		
		/**
		 * Initialize Custom Taxonomy
		 *
		 * @return	void
		 */

		function init_custom_taxonomy()  {
			
			$labels = array(
				'name'                       => _x( 'Positionen', 'Taxonomy General Name', 'kader' ),
				'singular_name'              => _x( 'Position', 'Taxonomy Singular Name', 'kader' ),
				'menu_name'                  => __( 'Position', 'kader' ),
				'all_items'                  => __( 'Alle Positionen', 'kader' ),
				'parent_item'                => __( 'Eltern Position', 'kader' ),
				'parent_item_colon'          => __( 'Eltern Position:', 'kader' ),
				'new_item_name'              => __( 'Neuer Positions Name', 'kader' ),
				'add_new_item'               => __( 'Neue Position hinzufuegen', 'kader' ),
				'edit_item'                  => __( 'Position bearbeiten', 'kader' ),
				'update_item'                => __( 'Position aktualisieren', 'kader' ),
				'separate_items_with_commas' => __( 'Positionen mit Kommas trennen', 'kader' ),
				'search_items'               => __( 'Position suchen', 'kader' ),
				'add_or_remove_items'        => __( 'Hinzufuegen oder Entfernen einer Position', 'kader' ),
				'choose_from_most_used'      => __( 'Waehle eine der meist benutzen Positionen', 'kader' ),
			);
			$rewrite = array(
				'slug'                       => 'position',
				'with_front'                 => true,
				'hierarchical'               => true,
			);
			$args = array(
				'labels'                     => $labels,
				'hierarchical'               => true,
				'public'                     => true,
				'show_ui'                    => true,
				'show_admin_column'          => true,
				'show_in_nav_menus'          => true,
				'show_tagcloud'              => true,
				'query_var'                  => 'position',
			);
			register_taxonomy( 'position', 'player', $args );
		
			}
			
		}
	// Kickoff
	if ( function_exists( 'add_filter' ) )
		Kader_Player::get_instance();
}